package net.dodoman.passby;

public class Tester {
	public static void main(String[] args) {
		int primitive = 2;
		changePrimitive(primitive);
		// primitive的值依然是2
		MyClass myClass = new MyClass();
		changeObject(myClass);
		// myClass仍然指向的是执行changeObject之前的那个对象
		// 但是myClass.i等于3了
	}

	public static void changePrimitive(int primitive) {
		primitive = 3;
	}

	public static void changeObject(MyClass myClass) {
		myClass.i = 3;
		myClass = new MyClass();
	}
}

class MyClass {
	int i;
}